<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/1/30
 * Time: 11:14
 */

namespace App;


use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class CafeEverydayRecommend extends Model
{
    use SoftDeletes;
    //指定表名
    protected $table='cafe_everyday_recommend';
    // 开启自动时间戳
    public $timestamps = true;
    // 日期都存储为时间戳
    protected $dateFormat = 'U';

    // 时间类型字段
    protected $dates = [
        'created_at',
        'updated_at',
        'deleted_at',
        'date'
    ];

    // 将钱数改变费用最低限单位从分换算成元
    public function getDateAttribute($value)
    {
        return date('Y/m/d', $value);
    }

    public function cafe()
    {
        return $this->belongsTo('App\Cafe', 'cafe_id', 'id');
    }
}